<template>
    <view class='news-unit'>
			<view class="uni-list">
			    <view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(value,index) in infoArray" :key="index"
			        >
					
					 <view class="uni-media-list" @click="goDetail(value)">
						<view class="uni-media-list-body">
							<view class="uni-media-list-text-top">{{value.title}}</view>
							<view class="uni-media-list-text-bottom">
								<text>来源: {{value.source ? value.source :'安宁交警'}}</text>
								<text>时间: {{value.createTime.substr(0,10) }}</text>
							</view>
						</view>
						<image v-if = "value.bannerImg1" class="uni-media-list-logo" :src="clacImgPath(value.bannerImg1)"></image>
						<image v-else class="uni-media-list-logo" src="/static/imgs/通知.jpg"></image>
						
					</view>
					
			    </view>
			</view>
    </view>
</template>

<script>
	import uniIcons from "@/components/uni-ui/uni-icons/uni-icons.vue"
	
    export default{
		components: {uniIcons},
        data() {
            return {
				unitNames:{
					seizure:"seizure",
					reqRescue:"reqRescue",
					resuced:"resuced",
				},
				last_id: "",
				vStatus: this.vehicleStatus,
            }
        },
		//父组件传递的数据
		props: {
			infoArray: { //需循环的输入数组
				type: Array,
				default () {
					return [];
				}
			},
			idx: { // index
				type: Number,
				default: 0
			},
			unitName:{
				type: String,
				default:'',
			}
		},
        methods:{
			doDel(){
				this.$store.commit("switch_loading")
			},
			clacImgPath(path){
				let baseUrl = this.$api.defConfig().baseUrl;
				
				console.log(baseUrl + '/upimg'+ path);
				
				return baseUrl + '/upimg'+ path;
			},
			goDetail(e) {
				//console.log("goDetail...");
				let detail = {
					author_name: e.source ? e.source :'安宁交警',
					cover: e.bannerImg1? this.clacImgPath(e.bannerImg1) : '/static/imgs/通知.jpg',
					id: e.id,
					post_id: e.post_id,
					published_at: e.createTime.substr(0,10),
					title: e.title,
					contentType: e.contentType,
					content: e.content,
				}
				uni.navigateTo({
					url: "/pages/bness/newDetail?detailDate=" + encodeURIComponent(JSON.stringify(
						detail))
				})
			},
			convertStatus(status){
				let _this = this;
			    let s = '未知';
				//console.log("_this.vehicleStatus:")
				//console.log(_this.vehicleStatus);
				for(let i in _this.vehicleStatus){
					//console.log("status:"+status);
					//console.log("status:"+_this.vehicleStatus[i]["code"]);
					if(status==_this.vehicleStatus[i]["code"]){
						s=_this.vehicleStatus[i]["name"];
						break;
					}
				}
				console.log(s);
				return s;
			},
			itemClick(){
				
			}
        },
		computed:{
			
		},
		created() {
			
		},
    }
</script>
<style lang='scss'>
    .news-unit{
		margin: 20upx 10upx;
		background-color: #ffffff;
		font-size: 28upx;
		transform: all 1s;
		font-size: 32upx;
		
	}
		.uni-list {
	        background-color: #FFFFFF;
	        position: relative;
	        width: 100%;
	        display: flex;
	        flex-direction: column;
	    }
	
	    .uni-list:after {
	        position: absolute;
	        z-index: 10;
	        right: 0;
	        bottom: 0;
	        left: 0;
	        height: 1px;
	        content: '';
	       -webkit-transform: scaleY(.5);
	        transform: scaleY(.5);
	        background-color: #c8c7cc;
	    }
	
	    .uni-list::before {
	        position: absolute;
	        z-index: 10;
	        right: 0;
	        top: 0;
	        left: 0;
	        height: 1px;
	        content: '';/* 
	        -webkit-transform: scaleY(.5);
	        transform: scaleY(.5);
	        background-color: #c8c7cc; */
	    }
	
	    .uni-list-cell {
	        position: relative;
	        display: flex;
	        flex-direction: row;
	        justify-content: space-between;
	        align-items: center;
			box-shadow: 0 10upx 10upx -5upx #999999;
	    }
	
	    .uni-list-cell-hover {
	        background-color: #eee;
	    }
	
	    .uni-list-cell::after {
	        position: absolute;
	        z-index: 3;
	        right: 0;
	        bottom: 0;
	        left: 30upx;
	        height: 1px;
	        content: '';
	        -webkit-transform: scaleY(.5);
	        transform: scaleY(.5);
	        background-color: #c8c7cc;
	    }
	
	    .uni-list .uni-list-cell:last-child::after {
	        height: 0upx;
	    }
	
	    /* 图文列表 */
	    .uni-media-list {
	        padding: 22upx 30upx;
	        box-sizing: border-box;
	        display: flex;
	        width: 100%;
	        flex-direction: row;
	    }
	
	    .uni-navigate-right.uni-media-list {
	        padding-right: 74upx;
	    }
	
	    .uni-pull-right {
	        flex-direction: row-reverse;
	    }
	
	    .uni-pull-right>.uni-media-list-logo {
	        margin-right: 0upx;
	        margin-left: 20upx;
	    }
	
	    .uni-media-list-logo image {
	        height: 100%;
	        width: 100%;
	    }
	
	
	    .uni-media-list-text-bottom {
	        width: 100%;
	        line-height: 30upx;
	        font-size: 26upx;
	        color: #8f8f94;
			padding-right: 20upx;
	    }
	
	    .uni-media-list-logo {
	        width: 180upx;
	        height: 140upx;
	        margin-right: 20upx;
	    }
	
	    .uni-media-list-body {
	        display: flex;
	        flex: 1;
	        flex-direction: column;
	        justify-content: space-between;
	        align-items: flex-start;
	        overflow: hidden;
	        height: auto;
	    }
	
	    .uni-media-list-text-top {
	        width: 100%;
	        line-height: 36upx;
	        font-size: 30upx;
	        height: 74upx;
	        font-size: 28upx;
	        overflow: hidden;
	    }
	
	    .uni-media-list-text-bottom {
	        display: flex;
	        flex-direction: row;
	        justify-content: space-between;
	    }
</style>